package cn.com.cifi.mars.bean.dto;

import cn.com.cifi.mars.util.NumberUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author jyx
 */
@Data
@ApiModel(value = "分期供货与签约", description = "分期供货与签约")
public class SupplyAndSignDto {

    @ApiModelProperty(name = "availableNum", value = "<可售货值>套数/车位数")
    private String availableNum;
    @ApiModelProperty(name = "availableAmount", value = "<可售货值>金额")
    private String availableAmount;

    @ApiModelProperty(name = "accumulativeSupplyNum", value = "<累计已供>套数/车位数")
    private String accumulativeSupplyNum;
    @ApiModelProperty(name = "accumulativeSupplyAmount", value = "<累计已供>金额")
    private String accumulativeSupplyAmount;

    @ApiModelProperty(name = "deliveryCompletionRate", value = "<供货完成率>%")
    private String deliveryCompletionRate;

    @ApiModelProperty(name = "accumulativeSoldNum", value = "<累计已售>套数/车位数")
    private String accumulativeSoldNum;
    @ApiModelProperty(name = "accumulativeSold", value = "<累计已售>金额")
    private String accumulativeSold;

    @ApiModelProperty(name = "contractCompletionRate", value = "<签约完成率>%")
    private String contractCompletionRate;

    @ApiModelProperty(name = "actualRemovalRate", value = "<实际去化率>%")
    private String actualRemovalRate;


    //计算百分率
    public void calculatedPercentage(){

        /* 供货完成率（累计已供金额/可售货值金额） */
        this.deliveryCompletionRate = NumberUtils.pricePercentage(this.accumulativeSupplyAmount,this.availableAmount);
        /* 签约完成率（累计已售金额/可售货值金额） */
        this.contractCompletionRate = NumberUtils.pricePercentage(this.accumulativeSold,this.availableAmount);
        /* 实际去化率(累计已售金额/累计已供金额) */
        this.actualRemovalRate = NumberUtils.pricePercentage(this.accumulativeSold,this.accumulativeSupplyAmount);
    }

}
